package fr.afcepf.ai89.esharing.data;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import fr.afcepf.ai89.esharing.entity.ImgProprietaire;
import fr.afcepf.ai89.esharing.entity.Proprietaire;
import fr.afcepf.ai89.esharing.entity.Valeur;
@Stateless
public class DAOImgProprietaire implements IDAOImgProprietaire {

	@PersistenceContext(unitName = "ESharingPhase22")
	EntityManager em;
	
	@Override
	public ImgProprietaire getImgProp(int idImgProp) {

		return null;
	}

	@Override
	public List<ImgProprietaire> getImgsProps() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<ImgProprietaire> getImgsProps(Proprietaire prop) {
		Query hql = em.createQuery("SELECT ip FROM ImgProprietaire ip INNER JOIN FETCH  ip.proprietaire p "
				+ "WHERE ip.proprietaire.idUtilisateur = :paramIdUtilisateur" );	
		
		hql.setParameter("paramIdUtilisateur", prop.getIdUtilisateur());
		List<ImgProprietaire> imgsProp= (List<ImgProprietaire>) hql.getResultList();
		return imgsProp;
	}

	@Override
	public int addImgProp(ImgProprietaire imgProp) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int majImgProp(ImgProprietaire imgProp) {
		// TODO Auto-generated method stub
		return 0;
	}

}
